<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>

<script type="text/javascript">
let m = {
	a:1,
	b:2,
	arr:['a','b','c']
}
//let o = {};

// Object.keys( m ).forEach(  key=>{
// 	Object.defineProperty( o , key , {
// 		get(){
// 			return m[key];
// 		},
// 		set(){
// 			console.log('修改了')
// 		}
// 	})  
// })

// o.arr[0] = 'xxxx';

// console.log( o );


let o = new Proxy(m , {
	get( target , key , receiver ){
		return Reflect.get( target , key , receiver    )
		//return target[key];
	},
	set( target , key ,value , receiver   ){
		return Reflect.set( target , key ,value , receiver    )
	}
})

o.arr[0] = 'xxx';

console.log( o );

</script>

</body>
</html>